//
//  ViewController1.m
//  ipad_split
//
//  Created by user on 12-8-20.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "ViewController1.h"
#import "ViewController2.h"

@interface ViewController1 ()

@end

@implementation ViewController1

@synthesize pDD;
@synthesize testPageControl;
@synthesize segmentOK;

- (void)dealloc
{
    self.pDD = nil;
    [testPageControl release];
    [segmentOK release];
    [super dealloc];
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"one";
    [self.testPageControl addTarget:self action:@selector(clickOL:) forControlEvents:UIControlEventValueChanged];
    
    [self.segmentOK addTarget:self action:@selector(selectBtn:) forControlEvents:UIControlEventValueChanged];
}

- (void)selectBtn:(id)sender
{
    UISegmentedControl * a = (UISegmentedControl*)sender;
    switch (a.selectedSegmentIndex) {
        case 0:
        {
            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"title" message:@"0" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];
            [alert show];
            [alert release];
        }
            break;
        case 1:
        {
            UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"title" message:@"1" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];
            [alert show];
            [alert release];
        }
            break;
            
        default:
            break;
    }
}

- (void)viewDidUnload
{
    [self setTestPageControl:nil];
    [self setSegmentOK:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
	return YES;
}

- (IBAction)clickOL:(id)sender
{
//    [self.pDD dismissModalViewControllerAnimated:YES];
//    UIAlertView * a = [[UIAlertView alloc] initWithTitle:@"title" message:@"message" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];
//    [a show];
//    [a release];
    ViewController2 * view2 = [[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:nil];
    view2.modalPresentationStyle = UIModalPresentationFormSheet;
    view2.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self.navigationController pushViewController:view2 animated:YES];
    [view2 release];
}

@end
